package cn.com.cetccst.usercenter.kv;

import android.content.Context;

import java.text.SimpleDateFormat;

import cn.com.cetccst.kvmanager.IKVStore;
import cn.com.cetccst.kvmanager.KVManager;

public class UserCenterKV {

    public static IKVStore kvStore;
    private static SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm");
    public static void initialize(Context context) {
        if (kvStore == null) {
            kvStore = new KVManager.Builder(context).setFileName("UserCenter").setModel(KVManager.MULTI_PROCESS_MODE).setCryptKey("**UserCenter**").build();
        }
    }

    public static String getUpgradeTime() {
        long ts = kvStore.decodeLong(UserCenterKeys.KEY_UPGRADE_TIME);
        if (ts< 0) {
            return "无";
        }
        return sDateFormat.format(ts);
    }

}
